/**
 * question列表页面的js脚本
 */

function getBook(gradeId,eleId){
	$(eleId).html('<option value="-1">全部</option>');
	if(gradeId == -1){
		return;
	}
	$.post("book/searchByGradeId",{"grade.gradeId":gradeId},function(data){
		if(typeof data == "string"){
			data = eval("("+data+")");
		}
		$.each(data,function(){
			var opt = $("<option></option>");
			opt.html(this.name);
			opt.val(this.bookId);
			opt.appendTo(eleId);
		});
	});
}

function getChapter(bookId,eleId){
	$(eleId).html('<option value="-1">全部</option>');
	if(bookId == -1){
		return;
	}
	$.post("chapter/searchByBookId",{"book.bookId":bookId},function(data){
		if(typeof data == "string"){
			data = eval("("+data+")");
		}
		$.each(data,function(){
			var opt = $("<option></option>");
			opt.html(this.name);
			opt.val(this.chapterId);
			opt.appendTo(eleId);
		});
	});
}